package com.siti.kindnessplatform.click.ctrl;

import com.siti.kindnessplatform.aspect.RequestLimit;
import com.siti.kindnessplatform.click.biz.EncourageBiz;
import com.siti.kindnessplatform.common.CommonResult;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

@RestController
@RequestMapping("encourage")
public class EncourageController {

    @Resource
    private EncourageBiz encourageBiz;

    @RequestLimit(maxCount = 1)
    @GetMapping(value = "saveEncourage")
    public CommonResult saveEncourage(@RequestParam("hospitalName")String hospitalName, HttpServletRequest request) {

        boolean flag=encourageBiz.encourageIt(hospitalName,request);
        if(flag){
            return new CommonResult("success","点赞成功");
        }else{
            return new CommonResult("error","点赞失败");
        }
    }
}
